<?php
namespace fabriek\auto;
class Model extends \fabriek\Moeder {
    private $_modellen = array(
        'coupe' => 19350,
        'cabrio' => 22450
    );
    
    public function zet($model='') {
        if (!empty($model) && array_key_exists($model,$this->_modellen)) {
            $_SESSION['Model'] = $model;
        }
        else {
            $this->reset();
        }
    }
    
    public function reset() {
        reset($this->_modellen);
        $_SESSION['Model'] = key($this->_modellen);
    }
    
    public function opties() {
        $html='';
        foreach ($this->_modellen as $model => $prijs) {
            $html .= <<<EOD
    <a href="{$model}" class="optieItem">
        <img src="images/model_{$model}.png">
        <h3>{$model}</h3>
        <h4>{$prijs}</h4>    
    </a>                
EOD;
        }
        return $html;
    }
    
    public function samenvatting() {
        $model = $_SESSION['Model'];
        $prijs = $this->_modellen[$model];
        return array('optie'=>$model,'prijs'=>$prijs);
    }
    
    public function afbeelding() {

    }
}
